package cn.sundat.model;

import java.util.List;

public class PageBean<T> {
	
	//当前页码
	private int currPage;
	//总页数
	private int totalPage;
	//总记录数
	private int totalCount;
	//每页的大小
	private int pageSize;
	//每页的所有内容
	private List<T> beanlist;
	
	public PageBean() {
		super();
	}
	

	public PageBean(int currPage, int totalCount, int pageSize, List<T> beanlist) {
		super();
		this.currPage = currPage;
		this.totalCount = totalCount;
		this.pageSize = pageSize;
		this.beanlist = beanlist;
	}



	public int getCurrPage() {
		return currPage;
	}

	public void setCurrPage(int currPage) {
		this.currPage = currPage;
	}

	public int getTotalCount() {
		return totalCount;
	}

	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public List<T> getBeanlist() {
		return beanlist;
	}
	
	public void setBeanlist(List<T> beanlist) {
		this.beanlist = beanlist;
	}
	
	

	public int getTotalPage() {
		return (int) Math.ceil(totalCount*1.0/pageSize);
	}

	@Override
	public String toString() {
		return "PageBean [currPage=" + currPage + ", totalPage=" + totalPage + ", totalCount=" + totalCount
				+ ", pageSize=" + pageSize + ", beanlist=" + beanlist + "]";
	}
	
	
}
